import {
	HTTP
} from '../utils/http.js';

const getPhoneUrl = 'https://scrm.bkchina.cn/scrm-bk-jd/jdUserController/getMobile';

class CouponModel extends HTTP {
	
	// 获取用户手机号
	getPhoneNumber(openId, accessToken) {
		return this.request({
			url: getPhoneUrl,
			header: 'application/x-www-form-urlencoded',
			method: 'POST',
			data: {
					"accessToken": accessToken,
					"openId": openId
				  }
		});
	}
		
	getMemberInfo(openId) {
		return this.request({
			url: 'queryMember',
			method: 'POST',
			data: { 
					"openId": openId ,
				  }
		});
	}
	
	getBanner() {
		return this.request({
			url: 'queryBanner',
			method: 'POST'
		});
	}
	
	getCouponCategory() {
		return this.request({
			url: 'queryCouponCategory',
			method: 'POST'
		})
	}
	
	getRefreshCardNo(cardNo) {
		return this.request({
			url: 'refreshCardNo',
			method: 'POST',
			data: {
					"cardNo": cardNo,
				  }
		})
	}
	
	getCoupon(couponId, openId, isPlus) {
		return this.request({
			url: 'sendCoupon',
			method: 'POST',
			data: {
					"couponId": couponId,
					"openId": openId,
					"isPlus": isPlus
				  }
		})
	}
	
}

module.exports = {
     CouponModel
};